home *** CD-ROM | disk | FTP | other *** search
/ Treccani Italiana Di Scienze Lettere Ed Arti / [Enciclopedia] Treccani Italiana di scienze lettere ed arti.iso / pc / data / xxi_appendice_dvd.swf / scripts / __Packages / CProspettiveImageButton.as < prev    next >
Text File  |  2007-11-08  |  3KB  |  133 lines

  1. class CProspettiveImageButton extends mx.core.UIObject
  2. {
  3.    function CProspettiveImageButton()
  4.    {
  5.       super();
  6.       this.mTween = null;
  7.       this.mStartPos = 12;
  8.       this.mEndPos = 5;
  9.       this.useHandCursor = false;
  10.       this.mc_ContentClip.createEmptyMovieClip("image_holder",this.mc_ContentClip.getNextHighestDepth() + 1);
  11.       this.mc_ContentClip.image_holder._alpha = 100;
  12.       this.mc_ContentClip.useHandCursor = false;
  13.       this.mCounter = 0;
  14.       this.init();
  15.    }
  16.    function init()
  17.    {
  18.    }
  19.    function GetImageTarget()
  20.    {
  21.       return this.mc_ContentClip.image_holder;
  22.    }
  23.    function onUnload()
  24.    {
  25.       if(this.mc_ContentClip.image_holder)
  26.       {
  27.          this.mc_ContentClip.image_holder.removeMovieClip();
  28.       }
  29.    }
  30.    function SetState(inState)
  31.    {
  32.       if(this.enabled)
  33.       {
  34.          if(inState == "rollOver" || inState == "over")
  35.          {
  36.             var _loc3_ = this.mStartPos;
  37.             if(this.mTween != null)
  38.             {
  39.                _loc3_ = this.mTween.position;
  40.                this.mTween = null;
  41.             }
  42.             this.mTween = new mx.transitions.Tween(this.mc_ContentClip,"_y",mx.transitions.easing.Regular.easeOut,_loc3_,this.mEndPos,5,false);
  43.             this.mCounter = 0;
  44.          }
  45.          else if(inState == "rollOut" || inState == "dw" || inState == "up")
  46.          {
  47.             _loc3_ = this.mEndPos;
  48.             if(this.mTween != null)
  49.             {
  50.                _loc3_ = this.mTween.position;
  51.                this.mTween = null;
  52.             }
  53.             this.mTween = new mx.transitions.Tween(this.mc_ContentClip,"_y",mx.transitions.easing.Regular.easeOut,_loc3_,this.mStartPos,5,false);
  54.             this.mCounter = 5;
  55.          }
  56.       }
  57.       else if(inState == "disabled")
  58.       {
  59.       }
  60.    }
  61.    function onRollOut()
  62.    {
  63.       this.SetState("rollOut");
  64.       this.dispatchEvent({type:"onThumbEvent",target:this,eventName:"rollOut",eventArg:this.mId});
  65.    }
  66.    function onRollOver()
  67.    {
  68.       this.SetState("rollOver");
  69.       this.dispatchEvent({type:"onThumbEvent",target:this,eventName:"rollOver",eventArg:this.mId});
  70.    }
  71.    function onPress()
  72.    {
  73.       this.SetState("dw");
  74.       this.dispatchEvent({type:"onThumbEvent",target:this,eventName:"click",eventArg:this.mId});
  75.    }
  76.    function onRelease()
  77.    {
  78.       this.SetState("over");
  79.    }
  80.    function onDragOut()
  81.    {
  82.       this.SetState("up");
  83.    }
  84.    function onDragOver()
  85.    {
  86.       this.SetState("dw");
  87.    }
  88.    function onReleaseOutside()
  89.    {
  90.       this.SetState("up");
  91.    }
  92.    function ReleaseMemory()
  93.    {
  94.       this.mc_ContentClip.image_holder.unloadMovie();
  95.    }
  96.    function disable()
  97.    {
  98.       this.enabled = false;
  99.       this.SetState("disabled");
  100.    }
  101.    function enable()
  102.    {
  103.       this.enabled = true;
  104.       this.SetState("up");
  105.    }
  106.    function SetEnabled(inV)
  107.    {
  108.       if(inV == true)
  109.       {
  110.          this.enable();
  111.       }
  112.       else
  113.       {
  114.          this.disable();
  115.       }
  116.    }
  117.    function isEnabled()
  118.    {
  119.       return this.enabled;
  120.    }
  121.    function onTweenRollout()
  122.    {
  123.       this.mCounter = this.mCounter - 1;
  124.       this.mShadowFilter.blurX = this.mCounter;
  125.    }
  126.    function onTweenRollover()
  127.    {
  128.       this.mCounter = this.mCounter + 1;
  129.       this.mShadowFilter.blurX = this.mCounter;
  130.       this.mc_ContentClip.filters[0].blurX = this.mCounter;
  131.    }
  132. }
  133.